/**************************************************************************
 * @doc SCAPI
 * @module SCProto.h - Header for general smart card functions.|  
 * Header for general smart card functions.
 *
 * Product     :   SoftPay 2000 (Global Payment Methodology).
 * <nl>Developer   :   SoftPay Development Team (I_SP2000).
 * <nl>Notes       :
 *
 * @head3 SCAPI Functions |
 * @index | SCPROTO
 * @end
 *
 * Copyright (c) 1996-2000 by VeriFone Inc. All rights reserved.
 * 
 * No part of this software may be used, stored, compiled, reproduced,
 * modified, transcribed, translated, transmitted, or transferred, in any form 
 * or by any means whether electronic, mechanical, magnetic, optical, 
 * or otherwise, without the express prior written permission of VeriFone, Inc.
 *
 * Revision History
 * ------------------------------------------------------------------------
 $Log: /SoftPay/SPK2SIM/Source/Scapi/Scproto.h $
 * 
 ********************************************************************************/
#ifndef SCPROTO_H
#define SCPROTO_H

#include <scdefine.h>
#include <define.h>
#include <transact.h>

int inSCCancelPIN(unsigned char ucPromptType, const char *pchDspMsg1,
                         const char *pchDspMsg2, unsigned char ucSlot1,
                         unsigned char ucSlot2);


int inSCConsoleSCR(unsigned char ucBeepType,
                          unsigned char ucPromptType, const char *pchDspMsg1,
                          const char *pchDspMsg2,unsigned char ucSlot1,
                          unsigned char ucSlot2);
                          
int  inGetSCPIN(unsigned char ucMKSWorkingKey, unsigned char *pucWorkingKey,
                char *pszAcctNumber, unsigned char *pucPinBlock,
                unsigned char ucPromptType, const char *pchDspMsg1,
                const char *pchDspMsg2, unsigned char ucSlot1, unsigned char ucSlot2);

int inSCRawComm(unsigned char *pucCommand, int inCmdLen,
                unsigned char *pucResponse, int inRspLen);
                

int inSCGetRandomNumber(unsigned char *pucRandomNumber);

int inSCGetSerialNumber(char *pchDst, unsigned char ucSize);

int inSCLoadMessageInSlot(unsigned char ucSlotNumber,char *pchMessage);

int inSCResetCard(CARD_SLOT, unsigned char *pucResponse, int inSize);

int inSCSetBeepSCR(unsigned char ucBeepType);

int inGetMaxTimeOut(void);    

int inSCSwitchOffCard(CARD_SLOT);

int inSCTestCardPresence(CARD_SLOT);

int inSCTestSCR(unsigned char *pucTestResp);

void vdHex2Dsp(char *pchHexBuf,char *pchDspBuf, int inCount);

void vdDsp2Hex(char *pchDspBuf,char *pchHexBuf, int inCount);

int inSCCardInfo(CARD_SLOT nCardSlot, unsigned char ucParam1,
				        unsigned char ucParam2, unsigned char ucDataLen,
						unsigned char *pbCardResp);

int inSCCCredit(unsigned char ucPurseOffset, unsigned char ucPurseFile,
				       unsigned char *pucCreditVal);

int inSCCCrossAuth(void);

int inSCCDebit(unsigned char ucPurseOffset, unsigned char ucPurseFile,
				      unsigned char *pucDebitVal, unsigned char *pucTTC);

int inSCGetResponse(CARD_SLOT nCardSlot, unsigned char ucDataLen,
				           unsigned char *pbCardResp);

int inSCCReadBalance(unsigned char ucPurseOffset, unsigned char ucPurseFile,
				            unsigned char *pucTTC, unsigned char *pucBalance);

int inSCCReadBin(CARD_SLOT nCardSlot,  unsigned char ucFileNum,
                WORD uiFileOffset, unsigned char ucSecureMsg, 
				unsigned char *pucResponse,int inBufLen);   

int inSCSelectFile(CARD_SLOT nCardSlot,  unsigned char ucType,
				          unsigned char ucDataLen, unsigned char *pucFileID);

int inSCCUpdateBin(CARD_SLOT nCardSlot,  unsigned char ucFileNum,
						  WORD uiFileOffset,unsigned char ucSecureMsg, 
						  unsigned char *pucResponse,int inBufLen);

int inSCCVerify(CARD_SLOT CardSlot, unsigned char ucKeySlot,
		               unsigned char ucSecCodeNum);

int inSCCWriteBin(CARD_SLOT nCardSlot,  unsigned char ucFileNum,
						 WORD uiFileOffset,unsigned char ucSecureMsg, 
						 unsigned char *pucResponse,int inBufLen);   

int inSCISOIn(CARD_SLOT nCardSlot, unsigned char *pucCommand, int inCmdLen);

int inSCISOOut(CARD_SLOT nCardSlot, unsigned char *pucCommand, int inCmdLen,
				      unsigned char *pucResponse, int inRspLen);

/* GPM Commands */

int inSCGPMEraseArea(unsigned char ucArea, unsigned char *pucEraseCode);

int inSCGPMEraseMem(unsigned char ucWordNumber, unsigned char ucSize);

int inSCGPMPresentCSC(unsigned char ucGPMCardType, unsigned char ucEncType,
                      unsigned char *pucCSC, unsigned char ucSize);

int inSCGPMReadArea(unsigned char ucArea, unsigned char *pucDst,
                    unsigned char ucSize);

int inSCGPMReadMem(unsigned char ucStartWord, unsigned char ucLength,
                   unsigned char *pucDstBuf, unsigned char ucDstBufSize);

int inSCGPMWriteArea(unsigned char ucArea, unsigned char *pucSrc, int inSize);

int inSCGPMWriteCSC(unsigned char ucGPMCardType, unsigned char ucEncType,
                    unsigned char *pucCSC, unsigned char ucSize);

int inSCGPMWriteMem(unsigned char ucWordNumber, unsigned char *pucSrc,
                    unsigned char ucSize);

int inSCInitSC552(void);

int inSCSetIdlePrompt(void);

int inSCDispStr(char chClrDisplay, char *pszDispStr);

int inSetupSC552Info(int);

int inSCTxRxPacket(int inPortHandle, const unsigned char *pucTxBuf, int inTxSize,
				   unsigned char *pucRxBuf, int  inRxSize, int inTimeOutSec);


int inSCGetPin(TRANSACTION_OBJECT *pobTran);


int inSCGetTipAmount(TRANSACTION_OBJECT *pobTran);


#endif
